/**
 * JavaScript datetime library.
 * @author shenw
 */
(function(){
	var root = pack('jshen.datetime');
	/**
	 * Get days count in month.
	 * @param {int} year
	 * @param {int} month
	 * @return {int} days
	 */
	root.method('getMonthDays', function(year, month){
		var m = month - 1;
		switch (m) {
			case 3:
			case 5:
			case 8:
			case 10:
				return 30;
			case 1:
				return 28 + this.isLeapYear(year) ? 1 : 0;
			default:
				return 31;
		}
	});
	root.method('isLeapYear', function(year){
		if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) {
			return true;
		}
		else {
			return false;
		}
	});
})();
